<template>
	<view>
		<uni-collapse v-model="curOpen" :accordion="true" @change="curCollapseChange" style="padding: 10px 0;">
			<subCouponCardVue ref="subCouponCard" :sid="curSID" :curItem="curOpen"></subCouponCardVue>
			<subLevelCardVue ref="subLevelCard" :sid="curSID" :curItem="curOpen"></subLevelCardVue>
			<subRedpackCardVue ref="subRedpackCard" :sid="curSID" :curItem="curOpen"></subRedpackCardVue>
			<subWalletCardVue ref="subWalletCard" :sid="curSID" :curItem="curOpen">
			</subWalletCardVue>
		</uni-collapse>
	</view>
</template>

<script>
	import psMethod from '@/common/psMethod';
	import psLib from '@/common/psLib';
	import subCouponCardVue from './sub-coupon-card.vue';
	import subLevelCardVue from './sub-level-card.vue';
	import subRedpackCardVue from './sub-redpack-card.vue';
	import subWalletCardVue from './sub-wallet-card.vue';
	export default {
		data() {
			return {
				title: '权益券',
				sConf: getApp().globalData,
				curSID: null,
				curOpen: null,
			}
		},
		components: {
			subCouponCardVue,
			subLevelCardVue,
			subRedpackCardVue,
			subWalletCardVue
		},
		methods: {
			open(e) {
				console.log('open', e);
				this.curSID = e
				// this.loadDefData()
			},
			curCollapseChange(e) {
				console.log('curCollapseChange', e);
				if (e === 'coupon') {
					this.$refs.subCouponCard.open(this.curSID)
				}
				if (e === 'level') {
					this.$refs.subLevelCard.open(this.curSID)
				}
				if (e === 'redpack') {
					this.$refs.subRedpackCard.open(this.curSID)
				}
				if (e === 'wallet') {
					this.$refs.subWalletCard.open(this.curSID)
				}
			}
		}
	}
</script>

<style lang="less" scoped>

</style>